#include"namedPipe.hpp"


// read
// 管理命名管道的生命周期
int main()
{
    NamePipe myfifo(comm_path,Creater);
    while (true)
    {
        if (myfifo.OpenForRead())
        {
            std::string massage;
            int n = myfifo.ReadPipe(&massage);
            if (n > 0)
            {
                std::cout << "client say: " << massage << std::endl;
            }
            else if(n == 0)
            {
                std::cout<<"client quit,server too!"<<std::endl;
                break;
            }
            else
            {
                std::cout<<"ReadPipe error"<<std::endl;
                break;
            }
        }
    }

    return 0;
}